from rest_framework import serializers
from goods.models import SpecificationOption
from goods.models import SPUSpecification

# spec_option 序列化器
class SpecOptionSerializer(serializers.ModelSerializer):
    spec = serializers.StringRelatedField(read_only=True)
    spec_id = serializers.IntegerField()

    class Meta:
        model = SpecificationOption
        fields = "__all__"


class OptionViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = SPUSpecification
        fields = ("id", "name")
